home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1995 April / Internet Tools.iso / infoserv / gopher / Unix / xvgopher / v0.5beta / xvgopher.shar.01.Z / xvgopher.shar.01 / GWAbout.cc < prev    next >
Encoding:
C/C++ Source or Header  |  1993-03-25  |  5.4 KB  |  210 lines

  1. //
  2. // GWAbout.cc
  3. //
  4. // (c) Copyright 1993, San Diego State University -- College of Sciences
  5. //       (See the COPYRIGHT file for more Copyright information)
  6. //
  7. // Implementation of the GWAbout class
  8. //
  9. #include "GWAbout.h"
  10. #include "xvgopher.h"
  11. #include "cursor.h"
  12. #include <fcntl.h>
  13. #include <unistd.h>
  14.  
  15. #define    KEY_TEXT_ITEM        20000
  16.  
  17.  
  18. static int            current_icon = 0;
  19. static Panel_item    icon;
  20.  
  21.  
  22. //***************************************************************************
  23. // GWAbout::GWAbout(Frame par)
  24. //
  25. GWAbout::GWAbout(Frame par)
  26. {
  27.     parent = par;
  28. }
  29.  
  30.  
  31. //***************************************************************************
  32. // int GWAbout::open(Response *)
  33. // PURPOSE:
  34. //   This will create an about window
  35. //
  36. int GWAbout::open(Response *)
  37. {
  38.     info = NULL;
  39.     compute_location(407, 107);
  40.     frame = (Frame) xv_create(parent, FRAME_CMD,
  41.         XV_X,                            next_x,
  42.         XV_Y,                            next_y,
  43.         XV_WIDTH,                        465,
  44.         XV_HEIGHT,                        369,
  45.         FRAME_LABEL,                    "About XvGopher",
  46.         FRAME_CMD_PIN_STATE,            FRAME_CMD_PIN_OUT,
  47.         FRAME_SHOW_RESIZE_CORNER,        FALSE,
  48.         XV_SHOW,                        TRUE,
  49.         FRAME_SHOW_FOOTER,                FALSE,
  50.         FRAME_DONE_PROC,                (void (*)(Frame)) done_proc,
  51.         XV_KEY_DATA,                    KEY_GWINDOW,    this,
  52.         NULL);
  53.     panel = (Panel) xv_get(frame, FRAME_CMD_PANEL);
  54.  
  55.     //
  56.     // Interpose onto the panel so that events will generate a call
  57.     //
  58.     notify_interpose_event_func(panel, (Notify_func) panel_events, NOTIFY_SAFE);
  59.  
  60.     //
  61.     // Create all the panel items
  62.     //
  63.     icon = (Panel_item) xv_create(panel, PANEL_MESSAGE,
  64.         XV_X,                            24,
  65.         XV_Y,                            12,
  66.         PANEL_LABEL_IMAGE,                get_gopher(0),
  67.         NULL);
  68.     xv_create(panel, PANEL_MESSAGE,
  69.         XV_X,                            112,
  70.         XV_Y,                            16,
  71.         PANEL_LABEL_STRING,                "XvGopher",
  72.         PANEL_LABEL_BOLD,                TRUE,
  73.         NULL);
  74.     xv_create(panel, PANEL_MESSAGE,
  75.         XV_X,                            112,
  76.         XV_Y,                            39,
  77.         PANEL_LABEL_STRING,                "Version 1.0",
  78.         PANEL_LABEL_BOLD,                TRUE,
  79.         NULL);
  80.     xv_create(panel, PANEL_MESSAGE,
  81.         XV_X,                            112,
  82.         XV_Y,                            62,
  83.         PANEL_LABEL_STRING,                "(c) Copyright 1993, San Diego StateUniversity",
  84.         PANEL_LABEL_BOLD,                TRUE,
  85.         NULL);
  86.     xv_create(panel, PANEL_MESSAGE,
  87.         XV_X,                            20,
  88.         XV_Y,                            96,
  89.         PANEL_LABEL_STRING,                "XvGopher was written in C++ by Andrew Scherpbier at SDSU.",
  90.         PANEL_LABEL_BOLD,                FALSE,
  91.         NULL);
  92.     xv_create(panel, PANEL_MESSAGE,
  93.         XV_X,                            20,
  94.         XV_Y,                            124,
  95.         PANEL_LABEL_STRING,                "Many thanks to the following people for testing, suggestions, and beer:",
  96.         PANEL_LABEL_BOLD,                FALSE,
  97.         NULL);
  98.     xv_create(panel, PANEL_MESSAGE,
  99.         XV_X,                            56,
  100.         XV_Y,                            156,
  101.         PANEL_LABEL_STRING,                "Mark Boyns",
  102.         PANEL_LABEL_BOLD,                TRUE,
  103.         NULL);
  104.     xv_create(panel, PANEL_MESSAGE,
  105.         XV_X,                            56,
  106.         XV_Y,                            179,
  107.         PANEL_LABEL_STRING,                "John Denune",
  108.         PANEL_LABEL_BOLD,                TRUE,
  109.         NULL);
  110.     xv_create(panel, PANEL_MESSAGE,
  111.         XV_X,                            56,
  112.         XV_Y,                            202,
  113.         PANEL_LABEL_STRING,                "Mike Halderman",
  114.         PANEL_LABEL_BOLD,                TRUE,
  115.         NULL);
  116.     xv_create(panel, PANEL_MESSAGE,
  117.         XV_X,                            56,
  118.         XV_Y,                            225,
  119.         PANEL_LABEL_STRING,                "Paul Lindner",
  120.         PANEL_LABEL_BOLD,                TRUE,
  121.         NULL);
  122.     xv_create(panel, PANEL_MESSAGE,
  123.         XV_X,                            216,
  124.         XV_Y,                            156,
  125.         PANEL_LABEL_STRING,                "Layout, icons, gopher chew, testing",
  126.         PANEL_LABEL_BOLD,                FALSE,
  127.         NULL);
  128.     xv_create(panel, PANEL_MESSAGE,
  129.         XV_X,                            216,
  130.         XV_Y,                            179,
  131.         PANEL_LABEL_STRING,                "Testing",
  132.         PANEL_LABEL_BOLD,                FALSE,
  133.         NULL);
  134.     xv_create(panel, PANEL_MESSAGE,
  135.         XV_X,                            216,
  136.         XV_Y,                            202,
  137.         PANEL_LABEL_STRING,                "Testing",
  138.         PANEL_LABEL_BOLD,                FALSE,
  139.         NULL);
  140.     xv_create(panel, PANEL_MESSAGE,
  141.         XV_X,                            216,
  142.         XV_Y,                            225,
  143.         PANEL_LABEL_STRING,                "Gopher icon",
  144.         PANEL_LABEL_BOLD,                FALSE,
  145.         NULL);
  146.     xv_create(panel, PANEL_MESSAGE,
  147.         XV_X,                            20,
  148.         XV_Y,                            260,
  149.         PANEL_LABEL_STRING,                "If you have comments or suggestions, please send E-Mail to:",
  150.         PANEL_LABEL_BOLD,                FALSE,
  151.         NULL);
  152.     xv_create(panel, PANEL_MESSAGE,
  153.         XV_X,                            60,
  154.         XV_Y,                            292,
  155.         PANEL_LABEL_STRING,                "xvgopher@gopher.sdsu.edu",
  156.         PANEL_LABEL_BOLD,                TRUE,
  157.         NULL);
  158.     xv_create(panel, PANEL_BUTTON,
  159.         XV_X,                            201,
  160.         XV_Y,                            328,
  161.         PANEL_LABEL_STRING,                "Dismiss",
  162.         PANEL_NOTIFY_PROC,                dismiss_proc,
  163.         NULL);
  164.     return OK;
  165. }
  166.  
  167.  
  168. //***************************************************************************
  169. // void GWAbout::dismiss_proc(Frame frame, Event *)
  170. // PURPOS:
  171. //   This gets called when the user presses 'q' in a window.
  172. //
  173. void GWAbout::dismiss_proc(Frame frame, Event *)
  174. {
  175.     GWindow    *win = (GWindow *) xv_get(frame, XV_KEY_DATA, KEY_GWINDOW);
  176.     delete win;
  177.     xv_destroy_safe(frame);
  178. }
  179.  
  180.  
  181. //***************************************************************************
  182. // void GWAbout::done_proc(Frame frame)
  183. // PURPOSE:
  184. //   This gets called whenever the about window is destroyed.  We need to
  185. //   clean up the associated GWindow structure.  Since we want all children
  186. //   to go away as well, we will call this function recursively on our subframes.
  187. //
  188. void GWAbout::done_proc(Frame frame)
  189. {
  190.     if (!frame)
  191.         return;
  192.     GWindow    *win = (GWindow *) xv_get(frame, XV_KEY_DATA, KEY_GWINDOW);
  193.     delete win;
  194.     xv_destroy_safe(frame);
  195. }
  196.  
  197.  
  198. //***************************************************************************
  199. // void GWAbout::panel_events(Xv_window, Event *, Notify_arg, Notify_event_type)
  200. //
  201. Notify_value GWAbout::panel_events(Xv_window win, Event *event, Notify_arg arg, Notify_event_type type)
  202. {
  203.     current_icon ^= 1;
  204.     xv_set(icon,
  205.         PANEL_LABEL_IMAGE,                get_gopher(current_icon),
  206.         NULL);
  207.     return notify_next_event_func(win, (Notify_event) event, arg, type);
  208. }
  209.  
  210.